<?php

namespace App\Models;


use Illuminate\Database\Eloquent\Model;

class CarPackageOrder extends Model
{
	
    protected $table = 'car_package_orders';

    protected $fillable = [
        'brand_id',
        'category_id',
        'store_id',
        'order_sn',
        'payment_sn',
        'code_url',
        'code_number',
        'package_id',
        'package_title',
        'package_pic',
        'merge_package_ids',
        'user_id',
        'user_name',
        'user_phone',
        'agreement',
        'agreement_at',
        'payment_at',
        'finnshed_at',
        'transact_name',
        'price',
        'order_price',
        'status',
        'remarks',
        'payment_type',
        'remarks_pics',
        'refund_price',
        'refund_status'
    ];

    public function brand()
    {
        return $this->belongsTo(Brand::class);
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }


    public function category()
    {
        return $this->belongsTo(CarPackageCategory::class);
    }

    public function store()
    {
        return $this->belongsTo(Store::class);
    }

    public function package()
    {
        return $this->belongsTo(CarPackage::class);
    }

    public function attr()
    {
        return $this->hasMany(CarPackageOrderAttr::class);
    }

    public function carPackageUsedLog()
    {
        return $this->hasMany(CarPackageUsedLog::class);
    }

    public function agreement()
    {
        return $this->hasMany(CarPackageOrderAgreement::class);
    }
}
